package com.opgea.crm.web.form;
 
import com.opgea.crm.common.util.DateUtil;
import com.opgea.crm.domain.entities.Issue;

 
 public class IssueForm { 
	// for  Text Box
	private Long   issueId;
	private String issueName;
	private String issueReason;
	private String issueModule;
	private Long  issueProjectId;
	

	private String issueCategory;
	private Long issueCategoryId;
	
	private String issuePriority;
	private Long   issuePriorityId;
	
	private String issueComplexity;
	private Long issueComplexityId;
	
	private String issueResolution;
	private Long   issueResolutionId;

	
	private String issueAssignedTo;
	private Long issueAssignedToId;
	
	private String issueStatus;
	private Long issueStatusId;
	
	private String createdBy;
	
	// for date
	private String date;
	private String targetDate;
	private String dateResolved;
	
	private String status;
	private Long statusId;
	
	private String priority;
	private Long priorityId;
	
	private String assignedTo;
	private Long assignedToId;
	
	private String complexity;
	private Long complexityId;
	
	private String resolution;
    private Long resolutionId;
	
	private String comment;
	private Long projectId; 
	
	private String category;
	private Long categoryId;
	
	public Long getIssueProjectId() {
		return issueProjectId;
	}

	public void setIssueProjectId(Long issueProjectId) {
		this.issueProjectId = issueProjectId;
	}

	public String getComplexity() {
		return complexity;
	}

	public void setComplexity(String complexity) {
		this.complexity = complexity;
	}

	public Long getComplexityId() {
		return complexityId;
	}

	public void setComplexityId(Long complexityId) {
		this.complexityId = complexityId;
	}

	public String getResolution() {
		return resolution;
	}

	public void setResolution(String resolution) {
		this.resolution = resolution;
	}

	public Long getResolutionId() {
		return resolutionId;
	}

	public void setResolutionId(Long resolutionId) {
		this.resolutionId = resolutionId;
	}

	public String getAssignedTo() {
		return assignedTo;
	}

	public void setAssignedTo(String assignedTo) {
		this.assignedTo = assignedTo;
	}

	public Long getAssignedToId() {
		return assignedToId;
	}

	public void setAssignedToId(Long assignedToId) {
		this.assignedToId = assignedToId;
	}

	public void setIssueAssignedToId(Long issueAssignedToId) {
		this.issueAssignedToId = issueAssignedToId;
	}

	public Long getIssueAssignedToId() {
		return issueAssignedToId;
	}

	public String getPriority() {
		return priority;
	}

	public void setPriority(String priority) {
		this.priority = priority;
	}

	public Long getPriorityId() {
		return priorityId;
	}

	public void setPriorityId(Long priorityId) {
		this.priorityId = priorityId;
	}

	public void setIssueAssignedTo(String issueAssignedTo) {
		this.issueAssignedTo = issueAssignedTo;
	}

	public String getIssueAssignedTo() {
		return issueAssignedTo;
	}

	public void setStatusId(Long statusId) {
		this.statusId = statusId;
	}

	public Long getStatusId() {
		return statusId;
	}

	public String getStatus() {
		return status;
	}

	public void setStatus(String status) {
		this.status = status;
	}



	public String getCategory() {
		return category;
	}

	public void setCategory(String category) {
		this.category = category;
	}

	public Long getCategoryId() {
		return categoryId;
	}

	public void setCategoryId(Long categoryId) {
		this.categoryId = categoryId;
	}

  // getter and setter
	public Long getIssueId() {
		return issueId;
	}
	
	public void setIssueId(Long issueId) {
		this.issueId = issueId;
	}
	public String getIssueName() {
		return issueName;
	}
	public void setIssueName(String issueName) {
		this.issueName = issueName;
	}
	public void setIssueReason(String issueReason) {
		this.issueReason = issueReason;
	}

	public String getIssueReason() {
		return issueReason;
	}
	
	public String getIssueModule() {
		return issueModule;
	}
	public void setIssueModule(String issueModule) {
		this.issueModule = issueModule;
	}
	
	public String getTargetDate() {
		return targetDate;
	}
	public void setTargetDate(String targetDate) { 
		this.targetDate = targetDate;
	}
	public void setIssueStatus(String issueStatus) {
		this.issueStatus = issueStatus;
	}

	public String getIssueStatus() {
		return issueStatus;
	}

	public void setIssueStatusId(Long issueStatusId) {
		this.issueStatusId = issueStatusId;
	}

	public Long getIssueStatusId() {
		return issueStatusId;
	}

	public String getDateResolved() {
		return dateResolved;
	}
	public void setDateResolved(String dateResolved) {
		this.dateResolved = dateResolved;
	}
	

	public void setDate(String date) {
		this.date = date;
	}

	public String getDate() {
		return date;
	}
	

	
	
	

	public void setCreatedBy(String createdBy) {
		this.createdBy = createdBy;
	}

	public String getCreatedBy() {
		return createdBy;
	}
	public void setComment(String comment) {
		this.comment = comment;
	}

	public String getComment() {
		return comment;
	}
	public void setProjectId(Long projectId) {
		this.projectId = projectId;
	}

	public Long getProjectId() {
		return projectId;
	}
	
  public void setIssueCategory(String issueCategory) {
		this.issueCategory = issueCategory;
	}

	public String getIssueCategory() {
		return issueCategory;
	}

public void setIssueCategoryId(Long issueCategoryId) {
		this.issueCategoryId = issueCategoryId;
	}

	public Long getIssueCategoryId() {
		return issueCategoryId;
	}

public void setIssuePriority(String issuePriority) {
		this.issuePriority = issuePriority;
	}

	public String getIssuePriority() {
		return issuePriority;
	}

public void setIssuePriorityId(Long issuePriorityId) {
		this.issuePriorityId = issuePriorityId;
	}

	public Long getIssuePriorityId() {
		return issuePriorityId;
	}

public void setIssueComplexity(String issueComplexity) {
		this.issueComplexity = issueComplexity;
	}

	public String getIssueComplexity() {
		return issueComplexity;
	}

public void setIssueComplexityId(Long issueComplexityId) {
		this.issueComplexityId = issueComplexityId;
	}

	public Long getIssueComplexityId() {
		return issueComplexityId;
	}

public void setIssueResolution(String issueResolution) {
		this.issueResolution = issueResolution;
	}

	public String getIssueResolution() {
		return issueResolution;
	}

public void setIssueResolutionId(Long issueResolutionId) {
		this.issueResolutionId = issueResolutionId;
	}

	public Long getIssueResolutionId() {
		return issueResolutionId;
	}

@Override
public String toString() {
	return "IssueForm [assignedTo=" + assignedTo + ", assignedToId="
			+ assignedToId + ", category=" + category + ", categoryId="
			+ categoryId + ", comment=" + comment + ", complexity="
			+ complexity + ", complexityId=" + complexityId + ", createdBy="
			+ createdBy + ", date=" + date + ", dateResolved=" + dateResolved
			+ ", issueAssignedTo=" + issueAssignedTo + ", issueAssignedToId="
			+ issueAssignedToId + ", issueCategory=" + issueCategory
			+ ", issueCategoryId=" + issueCategoryId + ", issueComplexity="
			+ issueComplexity + ", issueComplexityId=" + issueComplexityId
			+ ", issueId=" + issueId + ", issueModule=" + issueModule
			+ ", issueName=" + issueName + ", issuePriority=" + issuePriority
			+ ", issuePriorityId=" + issuePriorityId + ", issueProjectId="
			+ issueProjectId + ", issueReason=" + issueReason
			+ ", issueResolution=" + issueResolution + ", issueResolutionId="
			+ issueResolutionId + ", issueStatus=" + issueStatus
			+ ", issueStatusId=" + issueStatusId + ", priority=" + priority
			+ ", priorityId=" + priorityId + ", projectId=" + projectId
			+ ", resolution=" + resolution + ", resolutionId=" + resolutionId
			+ ", status=" + status + ", statusId=" + statusId + ", targetDate="
			+ targetDate + "]";
}

	public IssueForm(){}

	public IssueForm(Issue issue) { 
		
		this.setIssueId(issue.getId());
		this.setProjectId(issue.getProject().getId());
		this.setIssueProjectId(issue.getProject().getId()); 
		this.setIssueName(issue.getIssueName()); 
		this.setIssueModule(issue.getModuleId());
		this.setIssueReason(issue.getIssueReason());
	    if(issue.getCategory()!= null){
		this.setCategory(issue.getCategory().getFieldValue());
		this.setCategoryId(issue.getCategory().getId());
	    }
	    if(issue.getPriority()!= null){
			this.setIssuePriority(issue.getPriority().getFieldValue());
			this.setIssuePriorityId(issue.getPriority().getId());
		 }
	    if(issue.getComplexity()!= null){
			this.setComplexity(issue.getComplexity().getFieldValue());
			this.setComplexityId(issue.getComplexity().getId()); 
		    }
		if(issue.getAssignedTo()!=null){
			this.setAssignedTo(issue.getAssignedTo().getFirstName());
			this.setAssignedToId(issue.getAssignedTo().getId());
			}
		if(issue.getStatus()!=null){
	    this.setIssueStatus(issue.getStatus().getFieldValue());
		this.setIssueStatusId(issue.getStatus().getId()); 
		}
		
		if(issue.getResolution()!=null){
		this.setResolution(issue.getResolution().getFieldValue());
		this.setResolutionId(issue.getResolution().getId());
	    this.setCreatedBy(issue.getCreatedBy().getEmployee().getFirstName()); 
		this.setDate(DateUtil.dateToString(issue.getCreatedAt())); 
		this.setTargetDate(DateUtil.dateToString(issue.getTargetDate())); 
		this.setDateResolved(DateUtil.dateToString(issue.getResolvedDate()));
		
	}
	}
	};

